package webfinal.entity;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Student {
    private Integer id;
    private String name;
    private String stuNo;
    private Integer sex;
    // Mysql 8的驱动查出来的对应类型是 LocalDateTime, JDK 1.8 升级一个比较好用的日期类型
    private LocalDateTime regTime;
    private String regTimeStr;


    public String getRegTimeStr() {
        if(regTime!=null){
            return regTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        }
        return null;
    }

    public Integer getId() {
        return id;
    }

    public Student setId(Integer id) {
        this.id = id;
        return this;
    }

    public String getName() {
        return name;
    }

    public Student setName(String name) {
        this.name = name;
        return this;
    }

    public String getStuNo() {
        return stuNo;
    }

    public Student setStuNo(String stuNo) {
        this.stuNo = stuNo;
        return this;
    }

    public Integer getSex() {
        return sex;
    }

    public Student setSex(Integer sex) {
        this.sex = sex;
        return this;
    }

    public LocalDateTime getRegTime() {
        return regTime;
    }

    public Student setRegTime(LocalDateTime regTime) {
        this.regTime = regTime;
        return this;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", stuNo='" + stuNo + '\'' +
                ", sex=" + sex +
                ", regTime=" + regTime +
                '}';
    }
}


